package com.niiwoo.civet.trade.service.myloan;

import com.niiwoo.civet.trade.dto.common.ProjectBorrowerPlanDTO;
import com.niiwoo.civet.trade.dto.common.ProjectBorrowerSummaryDTO;
import com.niiwoo.civet.trade.dto.request.myloan.*;
import com.niiwoo.civet.trade.dto.response.myloan.*;
import com.niiwoo.civet.trade.dto.response.newRefund.OrgImmediateRepaymentResponseDTO;
import com.niiwoo.tripod.provider.dto.response.PageResponseDTO;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface MyLoanDubboService {
    LoanIndexQueryResponseDTO loanIndexQuery(String userId);

    PageResponseDTO<LoanPlanDateResponseDTO> loanPlanDateQuery(MyloanRequestDTO dto);

    PageResponseDTO<LoanPlanMonthResponseDTO> loanPlanMonthQuery(MyloanRequestDTO dto);

    Integer queryNotSettlementLoanCount(String userId);

    PageResponseDTO<LoanGoingResponseDTO> myloanGoingQuery(MyloanRequestDTO dto);

    PageResponseDTO<LoanEndResponseDTO> myloanEndedQuery(MyloanRequestDTO dto);

    PageResponseDTO<BackToArticleByDayResponseDTO> backToArticleDay(MyloanRequestDTO dto);

    PageResponseDTO<InvestorPlanDTO> backToArticleDayByDay(MyloanRequestDTO dto, Date receivedDate);

    ImmediateRepaymentResponseDTO queryImmediateRepayment(MyProjectRequestDTO dto);

    default OrgImmediateRepaymentResponseDTO queryOrgImmediateRepayment(String userId, String orgId){
        throw new UnsupportedOperationException("unimplemented");
    }

    ContractResponseDTO contractQuery(MyProjectRequestDTO dto);

    PageResponseDTO<BackToArticleByMonResponseDTO> listBackToArticleByMonth(MyloanRequestDTO dto);

    /**
     * 查询借款详情
     *
     * @param projectId
     * @param userId
     * @return
     */
    QueryProjectBorrowDetailReponseDTO queryProjectBorrowDetail(Long projectId, String userId);

    /**
     * 查询借款详情 APP接口(只需要少量数据)
     *
     * @param projectId
     * @param userId
     * @return
     */
    QueryProjectBorrowDetailAPPReponseDTO queryProjectBorrowDetailAPP(Long projectId, String userId);

    /**
     * 根据标的id获取项目标的详情(Jaylin)
     *
     * @param projectId
     * @return
     */
    ProjectDetailResponseDTO queryProjectDetailByProjectId(Long projectId);

    /**
     * 查询全额还款
     *
     * @param projectId
     * @param userId
     * @return
     */
    QueryFullAmountRepaymentReponseDTO queryFullAmountRepayment(Long projectId, String userId);

    /**
     * 查询还款安排
     *
     * @param projectId
     * @param userId
     * @return
     */
    QueryRepaymentPlanResponseDTO queryRepaymentPlan(Long projectId, String userId);

    /**
     * 查询还款记录
     *
     * @param projectId
     * @param userId
     * @return
     */
    QueryProjectDynamicReponseDTO queryProjectDynamic(Long projectId, String userId);

    Integer publishProject(LoanProjectRequestDTO dto);

    void cancelProject(LoanProjectRequestDTO dto);

    /**
     * 查询标的详情
     *
     * @param requestDTO
     * @return
     */
    UserProjectStatisticResponseDTO queryProjectInfoDetail(MyProjectRequestDTO requestDTO);

    /**
     * 查询用户的回款计划
     *
     * @param userId
     * @param projectId
     * @return
     */
    default ProjectInvestorPlanResponseDTO queryProjectInvestorPlan(String userId, Long projectId) {return null;}

    default ProjectInvestorPlanResponseDTO queryProjectInvestorPlan(String userId, Long investOrderId, Long projectId) {
        throw new UnsupportedOperationException("请使用queryProjectInvestorPlan(String,Long)代替");
    }

    /**
     * 查询我的还款计划(只查询今天该还款的还款计划)
     *
     * @return
     */
    List<ProjectBorrowerPlanDTO> queryMyLoanPlanByToday(String userId);

    /**
     * 查询我的逾期还款标的
     *
     * @return
     */
    List<ProjectBorrowerSummaryDTO> queryMyLoanOverdue(String userId);

    /**
     * 查询还款计划
     *
     * @param projectId
     * @param userId
     * @return
     */
    QueryRepaymentPlanResponseDTO queryRepaymentPlanDetail(Long projectId, String userId);

    /**
     * 查询用户待还本金，本金包括：还款中 + 筹款中 + 审核中
     * 此接口用来给机构开户时查询使用s
     *
     * @param userId
     * @return
     */
    default BigDecimal queryUserToPayCapital(String userId){return null;}

    default Integer isExistOverdueAndRepaymentProject(String userId){return null;}

    default public LoanVoucherAuditInfoQueryResponseDTO loanVoucherAuditInfoQuery(LoanVoucherAuditInfoQueryRequestDTO requestDTO){return null;}

    default public void loanVoucherSubmit(LoanVoucherSubmitRequestDTO requestDTO){}

    /**
     * 根据标的ID查询还款计划
     * @param projectId 标的ID
     * @return list
     */
    default List<ProjectBorrowerPlanDetailDTO> selectByProjectId(Long projectId){
        throw new UnsupportedOperationException("unimplemented");
    }

}
